<extend name="Public/base" />

<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i
				class="icon-home"></i> 首页</a> <a class="current">{$meta_title}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">

					<form method="post" class="form-horizontal">
				        <div class="control-group">
				            <label class="control-label">菜单标题</label>
				            <div class="controls">
				                <input type="text" class="text input-large" placeholder="例如：首页" name="title" value="{$info.title|default=''|change_str}">
				                <br><span class="help-block blue mt10">（用于后台显示的配置标题）</span>
				            </div>
				        </div>
				        <div class="control-group">
				            <label class="control-label">排序</label>
				            <div class="controls">
				                <input type="text" class="text input-small" placeholder="例如：0" name="sort" value="{$info.sort|default=0}">
				            </div>
				        </div>
				        <div class="control-group">
				            <label class="control-label">链接</label>
				            <div class="controls">
				                <input type="text" class="text input-large span5" placeholder="例如：/Admin/index" name="url" value="{$info.url|default=''|change_str}">
				                <br><span class="help-block blue mt10">（U函数解析的URL或者外链）</span>
				            </div>
				        </div>
				        <div class="control-group" style="height:50px;">
				            <label class="control-label">上级菜单</label>
				            <div class="controls">
				                <select name="pid" class="span3">
				                    <volist name="Menus" id="menu">
				                        <option value="{$menu.id}" <eq name="info.pid" value="$menu.id">selected</eq> >{$menu.title_show}</option>
				                    </volist>
				                </select>
				            </div>
				        </div>
				        <div class="control-group" style="height:50px;">
				            <label class="control-label">是否隐藏<span class="check-tips"></span></label>
				            <div class="controls">
				                <select name="hide" class="span2">
			                        <option value="0">否</option>
			                          <option value="1">是</option>
				                </select>
				            </div>
				        </div>
				        <div class="control-group" style="height:50px;">
				            <label class="control-label">仅开发者模式可见<span class="check-tips"></span></label>
				            <div class="controls">
				            	<select name="is_dev" class="span2">
			                        <option value="0">否</option>
			                          <option value="1">是</option>
				                </select>
				            </div>
				        </div>
				        <div class="control-group">
				            <label class="control-label">说明</label>
				            <div class="controls">
				                <input type="text" class="text input-large span5" name="tip" value="{$info.tip|default=''|change_str}">
				                <br><span class="help-block blue mt10">（菜单详细说明）</span>
				            </div>
				        </div>
				        <div class="form-actions">
				            <input type="hidden" name="id" value="{$info.id|default=''}">
							<button type="submit" class="btn btn-success" id="submit">保 存</button>
							<button type="button" class="btn btn-danger" onclick="javascript:history.back(-1);return false;">返 回</button>
				        </div>
				    </form>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(function(){
	$("form").submit(function(){
		//锁定提交按钮
		$(this).attr('disabled',true);
		var self = $('form');
		$.post("{$post_url}", self.serialize(), call_back, "json");
		return false;
		/**
		 * @todo 接收登录返回值
		 * @author PHP@妖孽 <dino_ma@163.com>
		 */
		function call_back(data){
			if(data.status == 1){
				tke_alert(data.info,'alert-success');
				setTimeout(function(){
					window.location.href = data.url;
				},1000);
			} else {
				tke_alert(data.info,'alert-error');
				$("#submit").attr('disabled',false);
			}
		}
	});
	//select 默认值
/* 	set_value("is_dev", {$info.is_dev|default=0});
	set_value("hide", {$info.hide|default=0}); */
/* 	set_value("pid", {$info.pid|default=0}); */
});
//左侧导航高亮
highlight_subnav("{:U('Menu/index')}");
</script>
</block>
